package com.addplus.townmall.server.api.mapper.town;

import com.addplus.townmall.server.api.model.town.DistributionPersonalShopType;
import com.addplus.townmall.server.api.model.town.PlatformCategory;
import com.addplus.townmall.server.api.utils.BaseAddMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 分销个人店关联商品类目 Mapper 接口
 * </p>
 *
 * @author zhangjiehang
 * @since 2018-08-27
 */
public interface DistributionPersonalShopTypeMapper extends BaseAddMapper<DistributionPersonalShopType> {

    /**
      * 方法描述：获取对应个人店铺分类列表
      *
      * @author zhangjiehang
      * @param
      * @return
      * @date 2018/9/22 上午11:56
      * @throws Exception
      */
    @Select("SELECT p.id,p.`name`,p.description FROM platform_category p LEFT JOIN distribution_personal_shop_type t ON t.shop_type_id = p.id AND t.is_delete =0 AND p.is_deleted = 0\n" +
            "WHERE t.personal_shop_id= #{distributionPersonalStoreId} ORDER BY p.sort")
    List<PlatformCategory> getPersonalShopCategory(@Param("distributionPersonalStoreId")Integer distributionPersonalStoreId);

}
